fix(db): respect vector extension config in per-bank index migration#832
Merged
nicoloboschi merged 2 commits intomainfrom Apr 1, 2026
Merged
fix(db): respect vector extension config in per-bank index migration#832nicoloboschi merged 2 commits intomainfrom
nicoloboschi merged 2 commits intomainfrom
Conversation
Migration d5e6f7a8b9c0 hardcoded HNSW when creating per-bank partial vector indexes, ignoring HINDSIGHT_API_VECTOR_EXTENSION. This caused banks migrated from pre-v0.4.18 to get HNSW indexes even when pgvectorscale (DiskANN) or vchord was configured. - Fix the original migration to read the vector extension config - Add migration a4b5c6d7e8f9 to detect and recreate mismatched indexes (skipped entirely when extension is pgvector, since those are correct)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
d5e6f7a8b9c0(introduced in v0.4.18) hardcodedUSING hnswwhen creating per-bank partial vector indexes, ignoringHINDSIGHT_API_VECTOR_EXTENSION. Banks that existed before upgrading to v0.4.18 got HNSW indexes even when pgvectorscale (DiskANN) or vchord was configured.HINDSIGHT_API_VECTOR_EXTENSIONenv vara4b5c6d7e8f9that detects mismatched per-bank indexes and recreates them with the correct type. The migration is skipped entirely when the configured extension ispgvector(default), since those indexes are already correct.Test plan
a4b5c6d7e8f9)HINDSIGHT_API_VECTOR_EXTENSION=pgvector— new migration should be a no-opHINDSIGHT_API_VECTOR_EXTENSION=pgvectorscaleon a DB with existing HNSW per-bank indexes — indexes should be recreated as DiskANNHINDSIGHT_API_VECTOR_EXTENSION=vchordon a DB with existing HNSW per-bank indexes — indexes should be recreated as vchordrq